```html
<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>MyBatis 类型处理器解析 | 技术小馆</title>
    <link rel="stylesheet" href="https://cdn.staticfile.org/tailwindcss/2.2.19/tailwind.min.css">
    <link rel="stylesheet" href="https://cdn.staticfile.org/font-awesome/6.4.0/css/all.min.css">
    <link href="https://fonts.googleapis.com/css2?family=Noto+Serif+SC:wght@400;500;600;700&family=Noto+Sans+SC:wght@300;400;500;700&display=swap" rel="stylesheet">
    <script src="https://cdn.jsdelivr.net/npm/mermaid@latest/dist/mermaid.min.js"></script>
    <style>
        body {
            font-family: 'Noto Sans SC', Tahoma, Arial, Roboto, "Droid Sans", "Helvetica Neue", "Droid Sans Fallback", "Heiti SC", "Hiragino Sans GB", Simsun, sans-serif;
            line-height: 1.8;
            color: #333;
        }
        h1, h2, h3, h4 {
            font-family: 'Noto Serif SC', serif;
            font-weight: 600;
        }
        .hero-gradient {
            background: linear-gradient(135deg, #6e8efb 0%, #a777e3 100%);
        }
        .code-block {
            background: #f8f9fa;
            border-left: 4px solid #6e8efb;
            transition: all 0.3s ease;
        }
        .code-block:hover {
            background: #edf2f7;
            transform: translateY(-2px);
        }
        .card {
            transition: all 0.3s ease;
            box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
        }
        .card:hover {
            transform: translateY(-5px);
            box-shadow: 0 10px 15px rgba(0, 0, 0, 0.1);
        }
        .typehandler-icon {
            color: #6e8efb;
        }
        .feature-icon {
            width: 60px;
            height: 60px;
            display: flex;
            align-items: center;
            justify-content: center;
            border-radius: 50%;
            background: rgba(110, 142, 251, 0.1);
            margin-bottom: 1rem;
        }
        .diagram-container {
            background: white;
            padding: 2rem;
            border-radius: 0.5rem;
            box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
        }
    </style>
</head>
<body class="bg-gray-50">
    <!-- Hero Section -->
    <section class="hero-gradient text-white py-20 px-4">
        <div class="container mx-auto max-w-5xl">
            <div class="flex flex-col items-center text-center">
                <div class="mb-6">
                    <i class="fas fa-exchange-alt text-4xl mb-4"></i>
                    <h1 class="text-4xl md:text-5xl font-bold mb-4">MyBatis 类型处理器解析</h1>
                    <p class="text-xl opacity-90 max-w-2xl mx-auto">
                        探索 Java 与数据库类型间的智能转换桥梁
                    </p>
                </div>
                <a href="#content" class="mt-8 px-6 py-3 bg-white text-indigo-600 rounded-full font-medium hover:bg-gray-100 transition duration-300">
                    <i class="fas fa-arrow-down mr-2"></i>开始探索
                </a>
            </div>
        </div>
    </section>

    <!-- Content Section -->
    <section id="content" class="py-16 px-4">
        <div class="container mx-auto max-w-5xl">
            <!-- Overview -->
            <div class="mb-20">
                <div class="flex items-center mb-6">
                    <div class="bg-indigo-100 w-12 h-12 rounded-full flex items-center justify-center mr-4">
                        <i class="fas fa-info-circle typehandler-icon text-xl"></i>
                    </div>
                    <h2 class="text-3xl font-bold text-gray-800">类型处理器概述</h2>
                </div>
                <p class="text-lg text-gray-700 mb-6">
                    MyBatis 使用 <code class="bg-indigo-100 px-2 py-1 rounded">TypeHandler</code> 接口来处理 Java 类型和数据库类型之间的转换。通过提供默认的和自定义的类型处理器，MyBatis 能够支持多种数据类型，并且允许开发者为特定需求定制转换逻辑。这种设计使得数据映射更加灵活和高效。
                </p>
                <div class="grid md:grid-cols-3 gap-6 mt-8">
                    <div class="card bg-white p-6 rounded-lg">
                        <div class="feature-icon mx-auto">
                            <i class="fas fa-random text-2xl text-indigo-600"></i>
                        </div>
                        <h3 class="text-xl font-semibold text-center mb-3">双向转换</h3>
                        <p class="text-gray-600 text-center">在Java对象和数据库字段间实现无缝类型转换</p>
                    </div>
                    <div class="card bg-white p-6 rounded-lg">
                        <div class="feature-icon mx-auto">
                            <i class="fas fa-cogs text-2xl text-indigo-600"></i>
                        </div>
                        <h3 class="text-xl font-semibold text-center mb-3">灵活扩展</h3>
                        <p class="text-gray-600 text-center">支持自定义类型处理逻辑满足特殊需求</p>
                    </div>
                    <div class="card bg-white p-6 rounded-lg">
                        <div class="feature-icon mx-auto">
                            <i class="fas fa-bolt text-2xl text-indigo-600"></i>
                        </div>
                        <h3 class="text-xl font-semibold text-center mb-3">高性能</h3>
                        <p class="text-gray-600 text-center">优化数据转换过程提升系统性能</p>
                    </div>
                </div>
            </div>

            <!-- How it works -->
            <div class="mb-20">
                <div class="flex items-center mb-6">
                    <div class="bg-indigo-100 w-12 h-12 rounded-full flex items-center justify-center mr-4">
                        <i class="fas fa-cog typehandler-icon text-xl"></i>
                    </div>
                    <h2 class="text-3xl font-bold text-gray-800">工作原理</h2>
                </div>
                
                <p class="text-lg text-gray-700 mb-6">
                    MyBatis 使用 <code class="bg-indigo-100 px-2 py-1 rounded">TypeHandler</code> 接口来处理这些转换。<code class="bg-indigo-100 px-2 py-1 rounded">TypeHandler</code> 是一个接口，提供了四个主要的方法：
                </p>
                
                <div class="grid md:grid-cols-2 gap-6 mb-8">
                    <div class="code-block p-6 rounded-lg">
                        <h4 class="font-bold text-lg mb-3 text-indigo-600">设置参数</h4>
                        <pre class="text-sm overflow-x-auto"><code>setParameter(PreparedStatement ps, 
    int i, T parameter, 
    JdbcType jdbcType)</code></pre>
                        <p class="mt-2 text-gray-600">将 Java 类型的参数设置到 PreparedStatement 中</p>
                    </div>
                    <div class="code-block p-6 rounded-lg">
                        <h4 class="font-bold text-lg mb-3 text-indigo-600">获取结果(字段名)</h4>
                        <pre class="text-sm overflow-x-auto"><code>getResult(ResultSet rs, 
    String columnName)</code></pre>
                        <p class="mt-2 text-gray-600">从 ResultSet 中获取数据库字段值并转换为 Java 类型</p>
                    </div>
                    <div class="code-block p-6 rounded-lg">
                        <h4 class="font-bold text-lg mb-3 text-indigo-600">获取结果(索引)</h4>
                        <pre class="text-sm overflow-x-auto"><code>getResult(ResultSet rs, 
    int columnIndex)</code></pre>
                        <p class="mt-2 text-gray-600">从 ResultSet 中按列索引获取值并转换</p>
                    </div>
                    <div class="code-block p-6 rounded-lg">
                        <h4 class="font-bold text-lg mb-3 text-indigo-600">获取存储过程结果</h4>
                        <pre class="text-sm overflow-x-auto"><code>getResult(CallableStatement cs, 
    int columnIndex)</code></pre>
                        <p class="mt-2 text-gray-600">从 CallableStatement 中获取存储过程返回值</p>
                    </div>
                </div>
            </div>

            <!-- Default Type Handlers -->
            <div class="mb-20">
                <div class="flex items-center mb-6">
                    <div class="bg-indigo-100 w-12 h-12 rounded-full flex items-center justify-center mr-4">
                        <i class="fas fa-boxes typehandler-icon text-xl"></i>
                    </div>
                    <h2 class="text-3xl font-bold text-gray-800">默认类型处理器</h2>
                </div>
                
                <p class="text-lg text-gray-700 mb-6">
                    MyBatis 提供了一些默认的类型处理器来处理常见的 Java 和数据库类型之间的转换，例如：
                </p>
                
                <div class="grid md:grid-cols-3 gap-4 mb-8">
                    <div class="bg-white p-4 rounded-lg border border-gray-100">
                        <div class="flex items-center mb-2">
                            <i class="fas fa-quote-right text-indigo-500 mr-2"></i>
                            <h4 class="font-bold">StringTypeHandler</h4>
                        </div>
                        <p class="text-gray-600 text-sm">用于处理 String 类型</p>
                    </div>
                    <div class="bg-white p-4 rounded-lg border border-gray-100">
                        <div class="flex items-center mb-2">
                            <i class="fas fa-hashtag text-indigo-500 mr-2"></i>
                            <h4 class="font-bold">IntegerTypeHandler</h4>
                        </div>
                        <p class="text-gray-600 text-sm">用于处理 Integer 类型</p>
                    </div>
                    <div class="bg-white p-4 rounded-lg border border-gray-100">
                        <div class="flex items-center mb-2">
                            <i class="far fa-calendar-alt text-indigo-500 mr-2"></i>
                            <h4 class="font-bold">DateTypeHandler</h4>
                        </div>
                        <p class="text-gray-600 text-sm">用于处理 java.sql.Date 和 java.util.Date 类型</p>
                    </div>
                </div>
                
                <div class="diagram-container my-8">
                    <div class="mermaid">
                        graph LR
                            A[Java类型] -->|TypeHandler| B[数据库类型]
                            B -->|TypeHandler| A
                            subgraph 默认处理器
                                C[StringTypeHandler]
                                D[IntegerTypeHandler]
                                E[DateTypeHandler]
                            end
                    </div>
                </div>
            </div>

            <!-- Custom Type Handlers -->
            <div class="mb-20">
                <div class="flex items-center mb-6">
                    <div class="bg-indigo-100 w-12 h-12 rounded-full flex items-center justify-center mr-4">
                        <i class="fas fa-code typehandler-icon text-xl"></i>
                    </div>
                    <h2 class="text-3xl font-bold text-gray-800">自定义类型处理器</h2>
                </div>
                
                <p class="text-lg text-gray-700 mb-6">
                    对于非标准类型，或者当需要特殊的转换逻辑时，可以自定义类型处理器。实现 <code class="bg-indigo-100 px-2 py-1 rounded">TypeHandler</code> 接口或扩展 <code class="bg-indigo-100 px-2 py-1 rounded">BaseTypeHandler</code> 类，并重写必要的方法。自定义类型处理器需要在 MyBatis 配置中注册，以便在运行时使用。
                </p>
                
                <div class="grid md:grid-cols-2 gap-8">
                    <div>
                        <h4 class="font-bold text-lg mb-3 text-indigo-600">实现自定义处理器</h4>
                        <div class="code-block p-6 rounded-lg">
                            <pre class="text-sm overflow-x-auto"><code>public class CustomEnumTypeHandler 
    extends BaseTypeHandler&lt;CustomEnum&gt; {

    @Override
    public void setNonNullParameter(PreparedStatement ps, 
        int i, CustomEnum parameter, 
        JdbcType jdbcType) throws SQLException {
        ps.setString(i, parameter.name());
    }

    @Override
    public CustomEnum getNullableResult(ResultSet rs, 
        String columnName) throws SQLException {
        String value = rs.getString(columnName);
        return value == null ? null : CustomEnum.valueOf(value);
    }

    // 其他方法实现...
}</code></pre>
                        </div>
                    </div>
                    <div>
                        <h4 class="font-bold text-lg mb-3 text-indigo-600">注册自定义处理器</h4>
                        <div class="code-block p-6 rounded-lg">
                            <pre class="text-sm overflow-x-auto"><code>&lt;configuration&gt;
  &lt;typeHandlers&gt;
    &lt;typeHandler 
      handler="com.ts.CustomEnumTypeHandler" 
      javaType="com.ts.CustomEnum"/&gt;
  &lt;/typeHandlers&gt;
&lt;/configuration&gt;</code></pre>
                        </div>
                    </div>
                </div>
            </div>

            <!-- Advantages -->
            <div class="mb-20">
                <div class="flex items-center mb-6">
                    <div class="bg-indigo-100 w-12 h-12 rounded-full flex items-center justify-center mr-4">
                        <i class="fas fa-star typehandler-icon text-xl"></i>
                    </div>
                    <h2 class="text-3xl font-bold text-gray-800">使用类型处理器的优势</h2>
                </div>
                
                <div class="grid md:grid-cols-3 gap-6">
                    <div class="bg-white p-6 rounded-lg border border-gray-100">
                        <div class="flex items-center mb-3">
                            <i class="fas fa-shield-alt text-indigo-500 mr-2 text-xl"></i>
                            <h3 class="text-xl font-semibold">类型安全</h3>
                        </div>
                        <p class="text-gray-600">自动转换确保 Java 类型和数据库类型的一致性，减少运行时错误。</p>
                    </div>
                    <div class="bg-white p-6 rounded-lg border border-gray-100">
                        <div class="flex items-center mb-3">
                            <i class="fas fa-code text-indigo-500 mr-2 text-xl"></i>
                            <h3 class="text-xl font-semibold">简化映射</h3>
                        </div>
                        <p class="text-gray-600">自动处理常见的数据类型转换，减少手动转换的样板代码。</p>
                    </div>
                    <div class="bg-white p-6 rounded-lg border border-gray-100">
                        <div class="flex items-center mb-3">
                            <i class="fas fa-magic text-indigo-500 mr-2 text-xl"></i>
                            <h3 class="text-xl font-semibold">自定义支持</h3>
                        </div>
                        <p class="text-gray-600">为特定类型提供自定义转换逻辑，满足复杂业务需求。</p>
                    </div>
                </div>
            </div>
        </div>
    </section>

    <!-- Footer -->
    <footer class="bg-gray-900 text-gray-300 py-12 px-4">
        <div class="container mx-auto max-w-5xl">
            <div class="text-center">
                <h3 class="text-xl font-bold text-white mb-2">技术小馆</h3>
                <p class="mb-4">探索技术奥秘，分享开发心得</p>
                <a href="http://www.yuque.com/jtostring" class="text-indigo-400 hover:text-indigo-300 transition duration-300">
                    <i class="fas fa-globe mr-2"></i>www.yuque.com/jtostring
                </a>
            </div>
        </div>
    </footer>

    <script>
        // Initialize Mermaid
        mermaid.initialize({
            startOnLoad: true,
            theme: 'default',
            flowchart: {
                useMaxWidth: true,
                htmlLabels: true,
                curve: 'basis'
            }
        });
        
        // Smooth scrolling for anchor links
        document.querySelectorAll('a[href^="#"]').forEach(anchor => {
            anchor.addEventListener('click', function (e) {
                e.preventDefault();
                document.querySelector(this.getAttribute('href')).scrollIntoView({
                    behavior: 'smooth'
                });
            });
        });
    </script>
</body>
</html>
```